package com.susallwave.srcb.exception;

import com.susallwave.srcb.response.ResultEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException{
    private final Integer code;
    private final ResultEnum resultEnum; // 👈 新增字段

    public BusinessException(String message) {
        super(message);
        this.code = 400;
        resultEnum = null;
    }

    public BusinessException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
        this.resultEnum = resultEnum;
    }

}
